/*
 * @Description: 非对称加密生成公钥私钥
 * @version:
 * @Author: 171
 * @Date: 2022-09-21 17:19:26
 * @LastEditors: 171
 * @LastEditTime: 2022-09-21 17:49:52
 */
import { generateKeyPairSync } from "crypto";


function generateKey(){
  const { publicKey, privateKey} = generateKeyPairSync("rsa", {
    modulusLength: 1024,
    publicKeyEncoding: {
      type: "spki",
      format: "pem",
    },
    privateKeyEncoding: {
      type: "pkcs8",
      format: "pem",
    },
  });
  return { publicKey, privateKey }
}


export default generateKey